// 讲师管理模块api文件
// 引入axios实例
import request from '@/utils/request'
export default{
  // 1.查询讲师列表
  list() {
    // 返回异步请求的结果
    return request({
      url: '/admin/edu/teacher/list',
      method: 'GET'
    })
  },
  // 2.带条件的查询讲师分页列表
  listPage(pageNum, pageSize, teacherQuery) {
    return request({
      url: `/admin/edu/teacher/list/${pageNum}/${pageSize}`,
      method: 'GET',
      /* 路径参数：直接在url中拼接
        请求体参数： data:参数json对象
        查询参数：params:参数json对象  axios会自动将json的属性拼接成kv结构的参数拼接到url地址后
       */
      params: teacherQuery
    })
  },
  // 删除指定讲师
  deleteById(id) {
    return request({
      url: `/admin/edu/teacher/removeById/${id}`,
      method: 'DELETE'
    })
  },
  // 根据id查询讲师
  getById(id) {
    return request({
      url: `/admin/edu/teacher/getById/${id}`,
      method: 'GET'
    })
  },
  // 更新讲师
  update(teacher) {
    return request({
      url: `/admin/edu/teacher/update`,
      method: 'PUT',
      data: teacher
    })
  },
  // 新增
  save(teacher) {
    return request({
      url: `/admin/edu/teacher/save`,
      method: 'POST',
      data: teacher
    })
  },
  // 批量删除
  batchDel(ids) {
    return request({
      url: `/admin/edu/teacher/batchRemove`,
      method: 'delete',
      // params: { ids: ids }
      params: { ids }
    })
  }
}
